//
//  viedioxqViewController.m
//  hainingOASystem
//
//  Created by michael on 2017/11/20.
//  Copyright © 2017年 czd. All rights reserved.
//
#import "PlayerView.h"
#import "UIView+SetRect.h"
#import "viedioxqViewController.h"
@interface viedioxqViewController ()

@end

@implementation viedioxqViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"视频新闻";
        _tableView = [[UITableView alloc]initWithFrame:self.view.frame style:UITableViewStylePlain];
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;

_tableView.dataSource = self;
_tableView.delegate = self;
[self.view addSubview:_tableView];
    

[self requestdata];
    // Do any additional setup after loading the view.
}

- (void)requestdata{


NSString *string = [[NSString alloc]initWithFormat:@"%@%@",knewsxq,_id];
[httpTool ZBPostNetDataWith:string withDic:nil andSuccess:^(NSDictionary* dictionary){
NSLog(@"%@",dictionary);
 
_dic = dictionary;

    [_tableView reloadData];
if (!dictionary) {
            [self.view makeToast:@"暂时还没数据哦"];
        }
 }andFailure:^{

 }];


}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    
    return 1;
}
#pragma mark UITableView dataScource
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell* cell = [[UITableViewCell alloc]init];
 cell.selectionStyle = UITableViewCellSelectionStyleNone;
  
    PlayerView *playerView = [[PlayerView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, 300)];
    [cell.contentView addSubview:playerView];
    //视频地址
  //http://192.168.1.181:8080/UploadFile/media/2017/11/1.mp4
  NSString *url = [NSString stringWithFormat:@"%@",_dic[@"DefaultPicUrl"]];

    playerView.url = [NSURL URLWithString:url];
 return cell;
}
 -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{

 
    return  120;

}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
//    return self.dataArray.count;
return 1;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
